package com.canbot.u05.activity.presidemode.newcode.bean;

import android.content.Context;
import android.text.TextUtils;

import com.canbot.u05.R;

public class NModuleType {
    public static final int DANCE_ADD = 0;
    public static final int DANCE_EDIT = 1;
    public static final int DANCE_MUSIC = 2;
    public static final int VOICE_MUSIC = 3;
    public static final int VOICE_TTS = 4;
    public static final int VOICE_NONE = 5;
    public static final int VOICE_RECORD = 6;
    public static final int ACTION = 7;
    public static final int ACTION_RANDOM = 8;
    public static final int ACTION_EXIST = 9;
    public static final int MOVE = 10;
    public static final int PICTURE = 11;
    public static final int EMOTION = 13;
    public static final int PICTURE_EMOTION = 14;
    public static final int VOICE = 15;
    public static final int ADD_ITEM = 16;
    public static final int EDIT_ITEM = 17;
    public static final int ACTION_NONE = 18;
    public static final int PICTURE_NONE = 19;

    public static final String EMOTION_XI = "xi.png";
    public static final String EMOTION_NU = "nu.png";
    public static final String EMOTION_AI = "ai.png";
    public static final String EMOTION_SI = "si.png";
    public static final String EMOTION_DAIJI = "daiji.png";
    public static final String EMOTION_JING = "jing.png";
    public static final String EMOTION_KONG = "kong.png";

    public static String getEmotionName(Context context, String name) {
        String str = "";
        switch (name) {
            case EMOTION_XI:
                str = context.getApplicationContext().getString(R.string.xi);
                break;
            case EMOTION_NU:
                str = context.getApplicationContext().getString(R.string.nu);
                break;
            case EMOTION_AI:
                str = context.getApplicationContext().getString(R.string.ai);
                break;
            case EMOTION_SI:
                str = context.getApplicationContext().getString(R.string.si);
                break;
            case EMOTION_DAIJI:
                str = context.getApplicationContext().getString(R.string.daiji);
                break;
            case EMOTION_JING:
                str = context.getApplicationContext().getString(R.string.jing);
                break;
            case EMOTION_KONG:
                str = context.getApplicationContext().getString(R.string.kong);
                break;
        }
        return str;
    }

    public static String getSpeedStr(Context context, String speed) {
        int intSpeed = Integer.parseInt(speed);
        switch (intSpeed) {
            case MoveBean.SPEED_HIGH:
                return context.getString(R.string.high);
            case MoveBean.SPEED_LOW:
                return context.getString(R.string.low);
            default:
                return context.getString(R.string.middle);
        }
    }

    public static int getMoveTime(MoveBean moveBean) {
        if (TextUtils.isEmpty(moveBean.speed)) {
            return 0;
        }
        int time = 2000;
        short speed = 300;
        switch (Integer.parseInt(moveBean.speed)) {
            case MoveBean.SPEED_LOW:
                speed = 300;
                break;
            case MoveBean.SPEED_NORMAL:
                speed = 500;
                break;
            case MoveBean.SPEED_HIGH:
                speed = 800;
                break;
            default:
                break;
        }
        float aFloat = 0;
        try {
            aFloat = Float.valueOf(moveBean.distance);
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
        switch (moveBean.orientation) {
            case UP:
                time += (aFloat * 1000 / speed) * 1000;
                break;
            case DOWN:
                time += (aFloat * 1000 / speed) * 1000;
                break;
            case LEFT:
                time += (aFloat * 100) / 6;
                break;
            case RIGHT:
                time += (aFloat * 100) / 6;
                break;
            default:
                time = 0;
        }
        if (time < 0) {
            return 0;
        }
        return time / 1000; //返回单位秒;
    }
}
